package com.lk2.core.services
{
	import com.lk2.core.config.IConfig;
	import com.lk2.core.util.LogFactory;
	
	import flash.events.Event;
	import flash.events.EventDispatcher;
	import flash.events.IEventDispatcher;
	
	import mx.logging.ILogger;
	

	/**
	 * The abstract class for application configuration management.
	 * This class shouldn't be used directly by application, even if Children doesn't implement or override functions
	 *  
	 * @author Luca Bianchi
	 * 
	 */
	public class AbsService implements IEventDispatcher, IService
	{
		private var _eventDispatcher:EventDispatcher;
		protected var configObj:IConfig;
		protected var logger:ILogger;
		

		public function AbsService(childConfigObj:IConfig)
		{
			//logger = LogFactory.getLogger(this);
			configObj = childConfigObj;
			_eventDispatcher = new EventDispatcher();			
		}
		
		
	
		public function hasEventListener(type:String):Boolean{
			return _eventDispatcher.hasEventListener(type);
		}
		
		public function willTrigger(type:String):Boolean{
			return _eventDispatcher.willTrigger(type);
		}
		
		public function addEventListener(type:String, listener:Function, useCapture:Boolean=false, priority:int=0.0, useWeakReference:Boolean=false):void{
			_eventDispatcher.addEventListener(type,listener,useCapture,priority,useWeakReference);
		}
		
		public function removeEventListener(type:String, listener:Function, useCapture:Boolean=false):void{
			_eventDispatcher.removeEventListener(type,listener,useCapture);
		}
		
		public function dispatchEvent(event:Event):Boolean{
			return _eventDispatcher.dispatchEvent(event);
		}
		
		public function refresh():void{
    		throw new Error("Abstract Method");  
	        return null;  
        }
         		
		public function get service():String{
    		throw new Error("Abstract Method");  
	        return null;  
        }
		
		public function set service(serviceURL:String):void{ 
    		throw new Error("Abstract Method");  
	        return null;  
        }
		
		

	}
}